﻿<%@ Page Language="C#" MasterPageFile="~/companypart/CompanyMastermaster.master" AutoEventWireup="true" CodeFile="CompanySubscription.aspx.cs" Inherits="companypart_CompanySubscription" Title="اشتراكات العميل" meta:resourcekey="PageResource1"%>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
 <link href="../jqModal.css" rel="stylesheet" type="text/css" />

 <%--   <script src="jquery-1.3.2.min.js" type="text/javascript"></script>--%>
    <script src="../jqModal.js" type="text/javascript"></script>
    <script type="text/javascript">

    function there() {

        $("#dialog").jqm({ modal: true }).jqmShow();


    }
    
      </script>
      <style type="text/css">
          
          tr .tabbone4{
	 background-color:#028ac5;
	 font-size:11px;
	 line-height:20px;
	 font-family:Tahoma;
  	 color:#fff;
  	 text-align:right;
	
}
.adel4{
	background-color:#ededed;
	font-size:10px;
	color:#084f86;
	font-family:Tahoma;
	height:30px;
	text-align:  right;
}
         .zr3 {
	background-image:url('../images/button2.png');
	display:block;
	float:right;
	 padding: 0px 10px 0px 10px;
	height:21px;
	text-align:center;
	color:#fff;
	text-shadow:1px 1px 0px #003a5e;
	margin-right:2px;
	line-height:19px;
	font-weight:bold;
	text-decoration:none;
	font-family:Tahoma;
	font-size:12px;


}
.zr3:hover ,.zr3:active {
	background-image:url('../images/button2.png');
	text-shadow:1px 1px 0px #003a5e;
	background-position:0px -21px;
	
}
  .stylelabel3
       {
       	color:#064c66;
	 font-weight:bold;
	 direction:rtl;
	 text-align:right;
       	}
             .tab3{
	width:815px;
 direction:rtl;
 border:1px #ccc solid;
 border-radius:5px;
 }

tr .tabbone3{
	 background-color:#028ac5;
	 font-size:11px;
	 line-height:20px;
	 font-family:Tahoma;
  	 color:#fff;
  	 text-align:center;
	
}
 .req3
       {
           color:Red;
       } 
.adel3{
	background-color:#ededed;
	font-size:10px;
	color:#084f86;
	font-family:Tahoma;
	height:30px;
	text-align:  center;
}
.he3{
	background-color:#fff;
	padding:5px;
	font-family:Tahoma;
	font-size:14px;
	font-weight:bold;
}
.txt3
{
    border:1px solid black;
    }
       

        .lok
     { 
	display: none;
	color: red;
     }
        .jqmWindow {
    display: none;
    
    position: fixed;
    top: 30%;
    left: 55%;
    
    margin-left: -300px;
    width: 350px;
    
    background-color: #fff;
    color: #333;
    border: 1px solid black;
    padding: 12px;
}

.jqmOverlay { background-color: #000; }

/* Fixed posistioning emulation for IE6
     Star selector used to hide definition from browsers other than IE6
     For valid CSS, use a conditional include instead */
* html .jqmWindow 
{
     position: absolute;
     top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px');
}
            </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<br />
<div class="jqmWindow" id="dialog">

<a href="#" class="jqmClose" style="background-image:url('../images/close.png');
	 width:39px;
	 height:40px;
	  background-repeat:no-repeat;
	  display:block;
	  float:left;	"></a>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
    <ContentTemplate>
   

     <table align="right"   dir="rtl">
     <tr>
    <td style="width:150px;" align="right">
    
    <asp:Label CssClass="stylelabel3"  ID="lbldis" runat="server" Text="الموزع" meta:resourceKey="lbldis" />
    
    </td>
    <td style="width:150px;" align="right">      <asp:DropDownList ID="dist" Width="140" CssClass="txt3" runat="server" AppendDataBoundItems="True" DataSourceID="SqlDataSource5"
            DataTextField="distributer" DataValueField="id">
            <asp:ListItem Value="0">اخر</asp:ListItem>
        </asp:DropDownList>
        <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [id], [distributer] FROM [distributers]"></asp:SqlDataSource>
  </td>
     </tr>
     <tr>
     <td align="right"> <asp:Label CssClass="stylelabel3"  ID="lblsatrtsub" runat="server" Text="بداية الاشتراك" meta:resourceKey="lblsatrtsub" /></td>
 
     <td align="right"><eo:datepicker Width="145"  ID="DatePicker1" runat="server" DayHeaderFormat="Full" 
                 DayCellHeight="16" DisabledDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" 
                                    OtherMonthDayVisible="True" DayCellWidth="19" TitleRightArrowImageUrl="DefaultSubMenuIcon"
                                    ControlSkinID="None" SelectedDates="">
                                    <DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid">
                                    </DayHoverStyle>
                                    <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;">
                                    </TitleStyle>
                                    <DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid">
                                    </DayHeaderStyle>
                                    <DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
                                    </DayStyle>
                                    <SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
                                    </SelectedDayStyle>
                                    <TitleArrowStyle CssText="cursor:hand"></TitleArrowStyle>
                                    <TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid">
                                    </TodayStyle>
                                    <PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;">
                                    </PickerStyle>
                                    <OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
                                    </OtherMonthDayStyle>
                                    <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma">
                                    </CalendarStyle>
                                    <DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
                                    </DisabledDayStyle>
                                    <MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px">
                                    </MonthStyle>
                                </eo:datepicker></td>
     </tr>
     <tr>
   <td> <asp:Label CssClass="stylelabel3"  ID="lblendsub" runat="server" Text="نهاية الاشتراك" meta:resourceKey="lblendsub" /></td>
 <td align="right"><eo:datepicker ID="DatePicker2" Width="145" runat="server" DayHeaderFormat="Full" 
              DayCellHeight="16" DisabledDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
                                    OtherMonthDayVisible="True" DayCellWidth="19" TitleRightArrowImageUrl="DefaultSubMenuIcon"
                                    ControlSkinID="None" SelectedDates="" >
                                    <DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid">
                                    </DayHoverStyle>
                                    <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;">
                                    </TitleStyle>
                                    <DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid">
                                    </DayHeaderStyle>
                                    <DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
                                    </DayStyle>
                                    <SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
                                    </SelectedDayStyle>
                                    <TitleArrowStyle CssText="cursor:hand"></TitleArrowStyle>
                                    <TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid">
                                    </TodayStyle>
                                    <PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;">
                                    </PickerStyle>
                                    <OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
                                    </OtherMonthDayStyle>
                                    <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma">
                                    </CalendarStyle>
                                    <DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
                                    </DisabledDayStyle>
                                    <MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px">
                                    </MonthStyle>
                                </eo:datepicker></td>
     </tr>
     
     <tr>
          <td> <asp:Label CssClass="stylelabel3"  ID="lblpaidfees" runat="server" Text="قيمة النسخة" meta:resourceKey="lblpaidfees" /></td>
       
     <td>    <asp:TextBox ID="paidfees" CssClass="txt3" runat="server"></asp:TextBox>
     <br />
     <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ErrorMessage="<%$ Resources:Resource, required %>" 
            ControlToValidate="paidfees" ValidationGroup="go" Visible="True"/>
  </td>
     </tr>
     <tr>    
       <td> <asp:Label CssClass="stylelabel3"  ID="lblcopyno" runat="server" Text="عدد النسخ" meta:resourceKey="lblcopyno" /></td>
      
     <td> <asp:TextBox ID="copyno" CssClass="txt3" runat="server"></asp:TextBox>
     <br />
     <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
            ErrorMessage="<%$ Resources:Resource, required %>" 
            ControlToValidate="copyno" ValidationGroup="go" Visible="True" />
    </td>
     </tr>
     <tr>
     <td colspan="2">
     <div id="lnkae" runat="server" visible="false">
 <table   dir="rtl">
     
     <tr>
     <td style="width:100px;">
     <asp:LinkButton  CssClass="zr3" ID="edit" runat="server" meta:resourceKey="lbledit" 
             onclick="edit_Click">تعديل</asp:LinkButton>
     </td>
      <td style="width:100px;">
     <asp:LinkButton CssClass="zr3"  ID="delete" runat="server"  meta:resourceKey="lbldelete" 
              onclick="delete_Click" >حذف</asp:LinkButton>
     </td>
     </tr>
     </table>
    <br />
</div>
     </td>
     </tr>
      <tr>
      <td></td>
        <td align="center">
     <asp:Button  style="float:left ;margin-left:50px"  CssClass="zr3" ID="save" runat="server" ValidationGroup="go" Text="حفظ" onclick="save_Click" meta:resourceKey="lblsave"  />
     </td>
     
      </tr>

</table>
 </ContentTemplate>
 <Triggers>
 <asp:PostBackTrigger ControlID="save" />
 <asp:PostBackTrigger ControlID="delete" />
 </Triggers>
    </asp:UpdatePanel>
  </div>
    
    <asp:UpdatePanel ID="up1" runat="server">
    <ContentTemplate>
   
      
    <table  dir="rtl">
<tr>
    
<td >           
  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
                    DataSourceID="SqlDataSource1" 
                     OnRowCreated="GridView1_RowCreated"
                    AllowPaging="True" onrowdatabound="GridView1_RowDataBound" 
        EnableModelValidation="True" GridLines="None" >
                    <PagerSettings FirstPageText="الاولى" LastPageText="الاخيرة"
                        NextPageText="التالى" PreviousPageText="السابق" />
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <div>
                                    <table class="tab3">
                                        <tr class="tabbone3">
                                            <td style="width:100px">
                                                <asp:Label ID="lblendofsubs" runat="server" Text="الكتاب/الدورية" meta:resourceKey="lblendofsubs"
                                                    />
                                            </td>
                                            
                                            <td style="width:75px">
                                                <asp:Label ID="lblstartofsubs" runat="server" Text="المؤلف" meta:resourceKey="lblstartofsubs"
                                                     />
                                            </td>
                                            <td style="width:100px">
                                                <asp:Label ID="lblpadfees" runat="server" Text="النشر" meta:resourceKey="lblpadfees"
                                                    />
                                            </td>
                                            
                                            <td style="width:50px">
                                                <asp:Label ID="lbltype" runat="server" Text="التردد" meta:resourceKey="lbltype"
                                                     />
                                            </td >
                                            <td style="width:170px">
                                                <asp:Label ID="lblissn" runat="server" Text="الرقم التعريفى" meta:resourceKey="lblissn"
                                                     />
                                            </td>
                                             <td style="width:100px">
                                                <asp:Label ID="lblendate" runat="server" Text="تاريخ الانتهاء" meta:resourceKey="lblendate"
                                                    />
                                            </td>
                                          <td style="width:130px">
                                                <asp:Label ID="deletelabel" runat="server" Text="تعديل" meta:resourceKey="lbldelete"
                                                    />
                                            </td>
                                            <td style="width:80px">
                                                <asp:Label ID="dislabel" runat="server" Text="التوزيع الداخلى" meta:resourceKey="lbldistrution"
                                                    />
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <table class="tab3">
                                    <tr class="adel3">
                                        <td style="width:100px">
                                            <asp:Label  ID="Label11" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("product"))) %>'
                                                 />
                                        </td>
                                        
                                        <td style="width:75px">
                                            <asp:Label  ID="startofsub" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("auther1"))) %>'
                                                 />
                                        </td>
                                        <td style="width:100px">
                                            <asp:Label  ID="paidfees" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("publisher"))) %>'
                                                 />
                                        </td>
                                        
                                        <td style="width:50px">
                                            <asp:Label  ID="Label12" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("freq"))) %>'
                                                 />
                                        </td >
                                        <td style="width:170px">
                                            <asp:Label  ID="Label13" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("issn"))) %>'
                                                />
                                        </td>
                                        <td style="width:100px">
                                            <asp:Label  ID="Label1" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("enddate"))) %>'
                                                />
                                        </td>
                                       <td style="width:130px">
                           
                              <%--  <asp:HiddenField ID="are" runat="server"  />--%>
                                <asp:LinkButton ID="aore" runat="server" AutoPostBack="true" OnClick="aore_Click" ToolTip='<%# String.Format("{0} , {1},{2}", Eval("mysub"), Eval("enddate"), Eval("freq_id")) %>' ></asp:LinkButton>
                              <%-- <asp:CheckBox runat="server" ID="chkAdd"   AutoPostBack="true" oncheckedchanged="CheckBox1_CheckedChanged" ToolTip='<%# String.Format("{0} , {1}", Eval("id"), Eval("enddate")) %>' ></asp:CheckBox> --%>
                             </td>
                               <td style="width:80px">
                                <asp:HyperLink runat="server" ID="edits" Text="" meta:resourceKey="lbledits"  Visible="false" NavigateUrl='<%# this.ResolveUrl("~/companypart/" + string.Format("SubscriptionInternals.aspx?proid={0}",Eval("mysub"))) %>'   />
                               </td>
                                    </tr>
                                </table>
                            </ItemTemplate>
                        </asp:TemplateField>
                   
                    </Columns>
                </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="select p.*,t.* ,t.id as mysub,f.* from Ragami.frequencies f  right JOIN Ragami.products p  ON (f.id = p.freq_id) INNER JOIN ragami.company_product t ON (t.product_id = p.id)   WHERE t.company_id = @company_id">
        <SelectParameters>
        <asp:SessionParameter Name="company_id" SessionField="company_id"  Type="Int32" />
           <%-- <asp:QueryStringParameter Name="company_id" QueryStringField="company" 
                Type="Int32" />--%>
        </SelectParameters>
    </asp:SqlDataSource>
                
   </td>
</tr>

</table>
 </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

